package com.wzh.ojcodesandbox.factory;

import lombok.extern.slf4j.Slf4j;

/**
 * @author wzh
 * @version 1.0
 * @data 2024/4/21 0:44
 * 懒汉式单例模式的实现
 */
@Slf4j
public class MyUncaughtExceptionHandler implements Thread.UncaughtExceptionHandler {

private static final MyUncaughtExceptionHandler instance =new MyUncaughtExceptionHandler();

private MyUncaughtExceptionHandler(){

}
    @Override
    public void uncaughtException(Thread t, Throwable e) {
    log.error("Exception in thread {} ", t.getName(), e);
    }

public static MyUncaughtExceptionHandler getInstance(){
    return instance;
}

}
